home *** CD-ROM | disk | FTP | other *** search
- ╔══════════════════════════════════════════════╤═════════════════════════════╗
- ║░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░┤K░E░N░J░I░░░B░A░U░G░H░A░M░'░S║
- ║░░████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░┼─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─╢
- ║░░█░░░░░░██░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░║
- ║░░█░░░░░░░█░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░║
- ║░░█░░░░░░██░░░░░░░░░░░░░░░░░╔═════════════════════════════════════════╗░░░░░║
- ║░░████████░░░░░░██████░░░░░░║C A C O P H O N Y ! !║░░░░░║
- ║░░█░░░░░░░░░░░░██░░░░██░░░░░╚═════════════════════════════════════════╝░░░░░║
- ║░░█░░░░░░░░░░░░█░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░║
- ║░░█░░░░░░░░░░░░█░░░░░░░░░░░░░░░V░░░░░N░░┐░░░┌─┐░░░░░░░░░░░░░░░░░░░░░░░░░░░░░║
- ║░░░░░░░░░░░░░░░██░░░░██░░░░░░░░░E░░░O░░░┴░■░└─┘░░░░░░░░░░░░░░░░░░░░░░░░░░░░░║
- ║░░░░░░░░░░░░░░░░██████░░░░░░░░░░░R░I░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░║
- ║░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░S░░░░░░░░░░░░░░░░░LET THE NIGHTMARE BEGIN!║
- ╚════════════════════════════════════════════════════════════════════════════╝
-
-
-
-
- ------****<<< INTRODUCTION >>>****------
-
- Welcome to the world of inane prattling on the PC speaker! Now you too can
- create irksome single voice mayhem and two part cacophony on the PC speaker!
- Furthermore, you can sit here and read an introduction section in which every
- sentence ends in an exclamation point!
-
- This product contains a header file and library for Borland C and C++
- products! These files make PC speaker music programming fun and easy!
-
- Now sit and back and be awed at the amazing sounds that your PC speaker can
- produce! You will hear sounds that you never thought were possible! You
- will either no longer feel the need to buy a sound card or you will feel
- embarrassed that you already have and try to return it or sell it to some
- unsuspecting fool who has not yet seen the wonders of PC Cacophony 1.0!
-
- Remember, the only limits are your imagination and your PC speaker (which of
- course is infinite in its capabilities)!
-
-
-
- ------****<<< DISCLAIMER >>>****------
-
- These files, to the best of my knowledge, bear coincidences to other
- files only through some freakish mishap of cosmic circumstance. Furthermore,
- these files do not blow up, infect, corrupt, implode, or cause any other
- damage to any of the components of my system, and I am completely
- unresponsible for any damage brought upon any users of these files. These
- files are FREEWARE and may therefore be distributed freely, but any
- distribution of any of these files must include this disclaimer.
-
- All files are copyright (C) 1994 Kenji Baugham.
-
-
-
- ------****<<< COMPATIBILITY >>>****------
-
- The library file and all cpp files are compatible with Borland C++ (the
- library functions can be called from C as well). They were written on
- Borland C++ 3.1 by Kenji Baugham with Matthew Amster as a programming
- consultant. Kenji can be addressed on the Internet at:
-
- cbaugham@pomona.claremont.edu
-
- I suppose you also need a PC speaker for this to work, but that's kind of
- standard so I don't know why I even mentioned it.
-
-
-
- ------****<<< SINGLE VOICE MAYHEM >>>****------
-
- The basic function of PC Cacophony is the note() function. Note() will
- generate a single tone as follows:
-
- note( pitch, duration );
-
- Pitch is the note to be played. Pitch can range from A to G within seven
- octaves. An "A" in the third octave is notated A3, a "B" in the fifth octave
- is notated B5, and so on. A4 is A440. The octaves begin with A, so A3 is
- lower pitched than C3. Thus the entire range of notes runs from A1 to G7.
- Accidentals are marked with F for flat and S for sharp in the form of AF2 for
- "A flat" in the second octave and AS2 for "A sharp" in the second octave.
-
- Duration is the length of the note. Duration can range from sixteenth notes
- (N16) to whole notes (N1). The following chart displays all possible note
- durations:
-
- N16 sixteenth note
- TN16 sixteenth note triplet
- N8 eighth note
- DN8 dotted eighth note
- TN8 eighth note triplet
- N4 quarter note
- DN4 dotted quarter note
- TN4 quarter note triplet
- N2 half note
- DN2 dotted half note
- N1 whole note
-
- An example follows. For those trumpet players out there, this is a dotted
- half note of "B flat" in the fourth octave:
-
- note( BF4, DN2 );
-
- Durations can also be joined together when a note length that is note
- described above is desired. The following examples will play two tied
- whole notes and an eighth note triplet tied to a half note respectively:
-
- note( C3, N1 + N1 );
- note( C3, TN8 + N2);
-
- The note() function can also be used to indicate rests. When this is
- desired, REST should be used for the pitch argument. The following example
- shows a half note rest:
-
- note( REST, N2 );
-
-
-
- ------****<<< TWO PART CACOPHONY >>>****------
-
- Two part PC speaker music requires a bit more planning. The function
- chord() follows the following paradigm:
-
- chord( pitch1, pitch2, duration );
-
- Pitch1 and pitch2 are the pitches of the two notes to be played. Duration
- has the same usage as it does in the note() function. The difficult part
- of two part cacophony is in the creation of two part monsterpieces in which
- the two parts have different rhythms. The technique for doing this is
- explained in the slurring section.
-
- The REST parameter can also be used in the chord function, and while this is
- never necessary, it can result in more consistent formatting. The following
- example shows how this could work:
-
- chord( C3, REST, N4 );
- chord( C3, G3, N4 );
- chord( REST, G3, N4 );
- chord( REST, REST, N4 );
- chord( C4, C4, N2 );
-
- While it may seem somewhat redundant to use the chord function for single
- notes, it maintains a more consistent and readable pattern when single notes
- and rests are the exceptions in a primarily two-part song.
-
-
-
- ------****<<< TEMPO >>>****------
-
- The tempo of the music can be adjusted by changing the global variable
- tempo defined in music.h. The default tempo is 100. Higher tempo values
- will generate a faster speed. Tempo works as a percentage, so 150 is 150%
- as fast as 100, 50 is 50% as fast as 100, and so on. An example for setting
- tempo to 125 is as follows:
-
- tempo = 125;
-
- Tempo can be changed at any point within the code. I should mention again
- that the music.h file does create and use a global variable "tempo". Hence,
- "tempo" can not be declared in any programs that include music.h.
-
-
-
- ------****<<< SLURRING >>>****------
-
- Slurring can be achieved with the schord(), snote(), and vsnote() commands.
- This will avoid the delay between notes, allowing notes to blend into one
- another. Snote() is a slurred note, schord() is a slurred chord, and vsnote()
- is a slurred vibrato note. Except for the lack of delay, these functions
- operate identically to their non-slurred counterparts.
-
- Aside from blending the notes, slurring may often be necessary for quick
- runs, as the pauses between notes might create an excessively staccato effect.
- Slurring is also very useful with chords in creating a two part cacophony in
- which the two parts play completely different rhythms. This may take some
- effort with more complicated patterns of rhythm interplay. The basic idea
- is that a new chord() command is issued each time either of the notes is to
- change, but both notes need not change. Consider the following example:
-
- schord( C3, C1, N4 );
- schord( C3, G1, N4 );
- schord( E3, G1, N4 );
- schord( E3, G0, N8 );
- chord( E3, C1, N8 );
-
- In this example, the upper part will play two half notes, whereas the second
- part will play a quarter note, a half note, and two eighth notes.
-
- Note that if a slurred note or chord is not followed by another note, the last
- note played will not stop until another note is played. This may continue
- when the program has stopped running and can be quite irritating. Hence,
- unless you enjoy droning tones it would be wise to always end with a
- non-slurred note or chord.
-
-
-
- ------****<<< VIBRATO >>>****------
-
- Vibrato is really quirky because of my limited programming knowledge.
- The length of vibrato notes may sometimes be shorter than expected, and
- very short notes may not play at all. I have tried to remedy the problem,
- but it's source eludes me as of yet, and I could only attempt a marginal
- solution which makes it a bit smoother.
-
- Vibrato is implemented through the vnote() and vsnote() functions, which
- operate much like the note() and snote() functions. Vnote() and vsnote() will
- create vibrato and slurred vibrato notes respectively. Vibrato chords are not
- possible. Here is an example of each:
-
- vsnote( E4, N1 );
- vnote( A5, N1 );
-
- In general, if vibrato is reserved for long notes ( Half notes at least ),
- then there will be only slight rhythmic difficulties. This can often be
- remedied by adding or subtracting sixteenth notes to the length of the note.
- Thus, a vibrato whole note in some cases may need to be as follows:
-
- vnote( C2, N1 + N16 );
-
-
-
- ------****<<< SYNCOPATION >>>****------
-
- Jazz syncopation can be attained with the use of sixteenth note triplets in
- the place of two eighth notes. The first eighth note should be replaced
- with the first two triplets, and the second eighth note should be replaced
- with the third triplet. Consider the following example:
-
- note( EF3, N8 );
- note( F3, N8 );
-
- This could be replaced with the following to create a jazzier feel.
-
- note( EF3, TN16 + TN16 );
- note( F3, TN16 );
-
- An example of syncopation can be seen in the file bluemonk.cpp.
-
-
-
- ------****<<< OUTRODUCTION >>>****------
-
- There, now that wasn't so bad now, was it?